-- damage_magic
-- created by panyl
-- 伤害类魔法效果N%概率提升M%

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 对敌伤害触发
    trigger = function(who, prop, arg)
        if type(arg) ~= "number" then
            return 0;
        end

        local damage = math.modf(arg * tonumber(prop[2]) / 1000);
        if DungeonM.getRandSeed("damage_magic") % 1000 >= prop[3] then
            return 0;
        end

        -- 触发特技发动事件
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1] });

        return math.max(1, damage);
    end,

    record = function(target, prop, path)
        return false;
    end
};
